#ifndef _aky_pwm_H
#define _aky_pwm_H
#include "aky_define.h"

typedef enum
{
    PUMP_DUTY = 0,
    VALVE_DUTY,
}e_pwm_t;

#define VALVE_PORT GPIO0 //快速阀
#define VALVE_PIN Pin_6
#define  VALVE_H  			(LINK2(CHAR_P,VALVE_PORT) |= VALVE_PIN)   
#define  VALVE_L 			(LINK2(CHAR_P,VALVE_PORT) &= ~(VALVE_PIN))	
#define VALVE_PROT_REG  LINK3(CHAR_P,VALVE_PORT,CHAR_M)//PxM
#define VALVE_UP_REG  LINK3(CHAR_P,VALVE_PORT,CHAR_UR)

#define VALVE_ON  pwm_out_put(100, 100,VALVE_DUTY);//输出最大pwm
#define VALVE_OFF  pwm_out_put(0, 100,VALVE_DUTY);

#define PUMP_ON  pwm_out_put(100, 100,PUMP_DUTY);//输出最大pwm
#define PUMP_OFF  pwm_out_put(0, 100,PUMP_DUTY);

#define  PUMPPWM_EN				TC1M |= (0X01 << 7)                    // PWM使能
#define  PUMPPWM_DIS			TC1M &= ~(0X01 << 7)                      // PWM使能

#define  VALVEPWM_EN			TC0M |= (0X01 << 7)                      // PWM使能
#define  VALVEPWM_DIS			TC0M &= ~(0X01 << 7)                     // PWM使能


#define	 VALVE									0x10				// VALVE
#define  PUMP										0x20				// PUMP
#define  POWER									0x40				// POWER
#define  LBTVAL										0x80				// LBT

#define  VALVEOFF								0x10			// VALVE off
#define  PUMPOFF 								0x20			// PUMP off
#define  POWEROFF								0x40			// POWER off
#define  LBTOFF									0x80			// LBT off

extern uint8 BB;


void aky_pwm_init(void);
void pwm_out_put(uint16_t per, uint16_t ful_range,e_pwm_t e_pwm);
void iocontrolon(void);
void iocontroloff(void);

#endif // 